<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3587：猴子挖矿</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">猴子挖矿</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">猴子挖矿</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                猴子挖矿                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：256MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p><span style="font-size: medium">　　cxm最近在玩一个叫做猴子挖矿的游戏。<br />
　　这个游戏由两个玩家参加。开始时地图中会随机生成一些矿点，玩家需要操作自己的猴子探索未知的道路，抢占对方的矿点。已经占领的矿点每回合会产生1单位的矿石。玩家用手中的矿石可以购买路灯、护盾、传送等道具。最终获得矿石较多的玩家获胜。<br />
　　cxm对这个游戏进行了一些改动。现在游戏在一个有n个点，m条边的有向图上进行，为了方便起见，cxm用1到n的整数来表示地图中的点。<br />
　　玩家只有一个，但他拥有无限数量的猴子。游戏最开始时，所有的猴子都在第1个点。每一回合，所有的猴子必须沿着图中的一条有向边移动到下一个点。玩家可以给不同的猴子指定不同的路线，但不能让猴子呆在原地不动。无路可走的猴子会在下一回合消失。<br />
　　游戏开始时为第0回合。从第S回合开始，到第T回合结束（包括第S回合和T回合），每回合每个点都会出产1单位的矿石。如果在该回合玩家有至少一只猴子在出产矿石的点，那么玩家将获得这个矿石，否则这个矿石会在下一回合消失。<br />
　　现在cxm想知道，在图中的每个点他分别最多可以获得多少个矿石。<br />
</span></p></p><hr/><h3>输入格式</h3><p><p><font size="4">　　标准输入。输入第一行包含四个正整数n,m,S,T，分别表示有向图中点的个数，边的个数，开始出产的时间和结束出产的时间。<br />
　　接下来m行，每行包含2个1到n的整数x,y，用空格隔开，表示有一条从第x个点到第y个点的有向边。<br />
</font></p></p><hr/><h3>输出格式</h3><p><p><font size="4">　　标准输出。输出n行，每行包含一个整数，按照1到n的顺序依次表示在每个点可以获得的矿石个数。<br />
</font></p></p><hr/><h3>样例输入</h3><pre>5 7 0 19
1 3
1 4
1 5
3 2
2 1
3 4
5 5
</pre><hr/><h3>样例输出</h3><pre>7
6
7
13
19
</pre><hr/><h3>提示</h3><p><p><span style="font-size: medium"><img height="573" width="607" alt="" src="../file/3587_0.jpg" /></span></p>
<p class="MsoNormal" align="left" style="background: white; margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan"><span style="font-size: medium"><span style="color: #200000; font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">　对于</span><span lang="EN-US" style="color: #200000; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">100%</span><span style="color: #200000; font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">的数据，保证</span><span lang="EN-US" style="color: #200000; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">0&lt;n&le;100</span><span style="color: #200000; font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，</span><span lang="EN-US" style="color: #200000; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">0&lt;m&le;300</span><span style="color: #200000; font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，</span><span lang="EN-US" style="color: #200000; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">0&le;S&le;T&le;10<sup>15</sup></span><span style="color: #200000; font-family: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">。</span></span><span lang="EN-US" style="color: #200000; font-family: &quot;Times New Roman&quot;; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><o:p></o:p></span></p></p><hr/><h3>题目来源</h3><p>By 佚名提供</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3587" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3587" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>